import { createStore } from 'vuex'

// https://vitejs.dev/guide/features.html#glob-import
// 动态导入延迟加载 import.meta.glob
// 直接导入所有模块 import.meta.globEager
const modulesFiles = import.meta.globEager('./modules/*.js')
const modules = {}
for (const path in modulesFiles) {
  const moduleName = path.replace(/(.*\/)*([^.]+).*/ig, '$2')
  modules[moduleName] = modulesFiles[path].default
}
const store = createStore({
  modules
})

export default store
